package com.jic.market.impl.rest.allocation;

import com.jic.market.common.enums.CostAllocationFlagEnum;
import com.jic.market.entity.AllocationModel;
import com.jic.market.entity.PromotionEntity;
import com.jic.market.request.PromotionRequest;
import com.jic.market.request.after.TellAddAllocationRequest;
import com.jic.market.request.rest.allocation.CollectionThemeInfoRequest;
import com.jic.market.response.PromotionResponse;
import com.jic.market.response.rest.allocation.QueryAllocationAndThemeInfoResponse;
import com.jic.market.service.JicMarketPromotionService;
import com.jic.market.service.allocation.PromotionAddAllocationStrategy;
import com.jic.market.service.rest.allocation.QueryPromotionForAllocationStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author xuyongliang
 * @version V1.0
 * @className PromotionAddAllocationStrategyNormal
 * @description 通用活动活动信息查询策略
 * @date 2020/4/10
 */
@Slf4j
@Service("queryPromotionForAllocationNormal")
public class QueryPromotionForAllocationStrategyNormal implements QueryPromotionForAllocationStrategy {

    @Resource
    private JicMarketPromotionService jicMarketPromotionService;


    @Override
    public QueryAllocationAndThemeInfoResponse collectionThemeInfo(CollectionThemeInfoRequest request) {
        log.info("--------进入通用活动活动信息查询策略request--{}-----",request);
        // 转成 long 类型
        String promotionCode = request.getPromotionCode();
        PromotionEntity promotionEntity = jicMarketPromotionService.queryEntity(promotionCode);

        QueryAllocationAndThemeInfoResponse model =new QueryAllocationAndThemeInfoResponse();
        model.setStartTime(promotionEntity.getStartTime());
        model.setEndTime(promotionEntity.getEndTime());
        model.setProUserType(promotionEntity.getProUserType());
//        model.setMailType();
        return model;
    }
}
